package com.hsgene.consumables.controller.v1;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.consumables.domain.v1.GeneticGoods;
import com.hsgene.consumables.domain.v1.GeneticGoodsApplyHistory;
import com.hsgene.consumables.service.GoodsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wangbing
 * @version 1.0, 2018/9/21
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Resource
    private GoodsService goodsService;

    /**
     * 查询id对应的耗材信息
     *
     * @param ids 耗材id，多个以,分隔
     * @return 耗材信息列表
     */
    @GetMapping("")
    public ApiResult<List<GeneticGoods>> queryGeneticGoods(@RequestParam("ids") String ids) {
        return goodsService.queryGeneticGoods(ids);
    }

    /**
     * 查询地服拥有的耗材使用信息
     *
     * @return 耗材使用信息
     */
    @GetMapping("servant")
    public ApiResult<List<GeneticGoodsApplyHistory>> queryServantGoods(
            @RequestParam("groundServantId") String groundServantId) {
        return goodsService.queryServantGoods(groundServantId);
    }
}
